# Contributor: fossdd <fossdd@pwned.life>
# Maintainer: fossdd <fossdd@pwned.life>
pkgname=sway-contrib
pkgver=1.9
pkgrel=0
pkgdesc="A collection of user-contributed scripts for Sway"
url="https://github.com/OctopusET/sway-contrib"
arch="noarch"
license="MIT"
depends="
	python3
	py3-i3ipc
	"
_grimshot_depends="
	cmd:grim
	cmd:jq
	cmd:notify-send
	cmd:slurp
	cmd:swaymsg
	cmd:wl-copy
	"
makedepends="$_grimshot_depends"
subpackages="
	$pkgname-doc
	grimshot
	grimshot-doc:_grimshot_doc
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/OctopusET/sway-contrib/archive/$pkgver.tar.gz"
options="!check" # no tests available

package() {
	install -Dm755 -t "$pkgdir"/usr/share/$pkgname/ \
		autoname-workspaces.py \
		firefox-focus-monitor.py \
		inactive-windows-transparency.py \
		layout-per-window.py \
		switch-top-level.py

	install -Dm755 grimshot -t "$pkgdir"/usr/bin/

	install -Dm644 README.md -t "$pkgdir"/usr/share/doc/$pkgname/
	install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}

grimshot() {
	pkgdesc="Script for taking screenshots with grim and slurp on Sway"
	depends="$_grimshot_depends"

	amove usr/bin/grimshot
}

_grimshot_doc() {
	install -Dm644 "$builddir"/grimshot.1 -t "$pkgdir"/usr/share/man/man1/

	default_doc
	pkgdesc="Documentation for grimshot"
	install_if="docs ${subpkgname%-doc}=$pkgver-r$pkgrel"
}

sha512sums="
333536be50622c3db55484d273ae7082d4d8780f44b99f36897288138423471e8fc1c622f5336ef84e6ecad6791746b8049e49ad37c8d53520f37e71900932fd  sway-contrib-1.9.tar.gz
"
